<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<meta name="viewport"
	content="user-scalable=no, width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<title>邮宝洗衣</title>
<link href="../../css/style2app.css" rel="stylesheet" type="text/css">
<link href="../../css/type.css" rel="stylesheet" type="text/css">
<style type="text/css">
/*<![CDATA[*/
* html .decoration {
	position: absolute;
	right: 16px;
	top: 0;
} /*only for ie*/
/*]]>*/
</style>
<!-- Do not move the bellow script to custom.js! It must stay here to
    load properly! -->
<script type="text/javascript" src="../../scripts/jquery.js"></script>
<script type="text/javascript" src="../../scripts/custom2app.js" charset="utf-8"></script>
<script type="text/javascript" src="../../scripts/jquerysession.js"></script>
<script type="text/javascript" src="../../scripts/layer/layer.m.js"></script>
</head>
<body onLoad="loadImages()">
	<p class="no-mobile">
		请使用手机访问本页面！ <br /> 这个页面是专门针对手机设计的！
	</p>
	<div class="site">
		<div id="hidepage">
			<p class="center-text">
				加载中，请耐心等待! <br /> <img src="../../images/background/130.gif"
					alt="load">
			</p>
		</div>
	<div class="decoration">
			<div class="back">
				<a href="getcloth.jsp">
					<img src="../../images/home/back.png">
				</a>
			</div> 
			<p class="title" style="width: 33%;float: left;">我要洗衣</p>
			<div style="width: 33%">
			</div> 
	</div>
	<div id="wrapper">

		<div class="msg">
			<p>请您完善<font color="#ff6c0d">送衣方式</font>、服务时间和收送地址，方便我们更好的为您服务</p>
		</div>
		<div class="home_table">
			<table border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td
						style="border-right: 1px solid #a0a0a0; border-bottom: 1px solid #a0a0a0;">上门日期</td>
					<td class="data" style="border-bottom: 1px solid #a0a0a0;">
						<div class="ui-select">
							<select>
							</select>
						</div> 
					</td>
				</tr>
				<tr>
					<td style="border-right: 1px solid #a0a0a0;">服务时间段</td>
					<td class="data">
						<div class="ui-select">
							<select>
								<!-- <option value="8">08:00--10:00</option>
								<option value="10">10:00--12:00</option> -->
								<option value="12">12:00--14:00</option>
								<option value="14">14:00--16:00</option>
								<option value="16">16:00--18:00</option>
							</select>
						</div>
					</td>
				</tr>
				<tr>
					<td class="data" colspan="2" style="border-top: 1px solid #a0a0a0;">
						<div class="select">
							<input type="radio" checked="checked" name="send" id="person"
								value="0"> <label name="person" class="lchecked"
								>等待上门收衣</label> <input type="radio" disabled="disabled"
								name="send" value="1" id="box"> <label name="box"
								class="lnotchecked">放在收衣柜中</label>
						</div>
					</td>
				</tr>
				<tr>
					<td colspan="2" style="border-top: 1px solid #a0a0a0;text-align: left;">
						<div><p style="float: left;">留言:</p></div>
						<div><textarea style="float: left;width: 100%" rows="5" cols="20"></textarea></div>
					</td>
				</tr>
			</table>
		</div>
		<div class="next_lag">
			<a href="javascript:void(0)">
				<img src="../../images/home/next_lag.png">
			</a>
		</div> 
		<!--order end-->
	</div>
	</div>
	<script type="text/javascript">
	 $(document).ready(function () {
		    var orderTimeStart = $.session.get("receiveOrderTimeStart");
		    var startTime=new Date(orderTimeStart.replace("-", "/").replace("-", "/"));  
		 	var dateOpinion = getDateString(startTime);
		 	$(".ui-select:eq(0)").find("select").html(dateOpinion);
		});
	 $(".next_lag").live("click",function(){
		 var sendType = $(".select").val();
		 var comment = $("textarea").val();
		 var dateVal = $(".ui-select:eq(0)").find("select").val();
		 var startTime = $(".ui-select:eq(1)").find("select").val();
		 var date = new Date();
		 date.setDate(date.getDate()+parseInt(dateVal));
		 date.setHours(parseInt(startTime),0,0,0);
		 var sendOrderTimeStart = date.Format("yyyy-MM-dd hh:mm:ss");
		 date.setHours((parseInt(startTime)+2),0,0,0);
		 var sendOrderTimeEnd = date.Format("yyyy-MM-dd hh:mm:ss");
		 var getType = $.session.get('getType');
		 var sendAndReceiveType = 0;
		 if(getType==0&&sendType==0)sendAndReceiveType = 0;
		 else if(getType==1&&sendType==0)sendAndReceiveType = 1;
		 else if(getType==0&&sendType==1)sendAndReceiveType = 2;
		 else if(getType==1&&sendType==1)sendAndReceiveType = 3;
		 var receiveAddr = $.session.get("receiveAddr");
		 var receiveOrderTimeStart = $.session.get("receiveOrderTimeStart");
		 var receiveOrderTimeEnd = $.session.get("receiveOrderTimeEnd");
		 var url = "../../transactionRouter2app?funcID=0003"
			+"&platformId="+$.session.get("platformId")
			+"&receiveAddr="+encodeURI(encodeURI(receiveAddr))
			+"&sendAndReceiveType="+sendAndReceiveType
			+"&receiveOrderTimeStart="+receiveOrderTimeStart
			+"&sendOrderTimeEnd="+sendOrderTimeEnd
			+"&sendOrderTimeStart="+sendOrderTimeStart
			+"&receiveOrderTimeEnd="+receiveOrderTimeEnd
			+"&comment="+encodeURI(encodeURI(comment))
			+"&commodityIds="+$.session.get("commodityIds")
			+"&goodsNums="+$.session.get("goodsNums")
			+"&totalNums="+$.session.get("totalNum")
			+"&totalPrice="+$.session.get("totalPrice");
		 $.post(url, function(v) {
			 if(v.responseCode=="00000"){
					layer.open({content: '请您等待工作人员'+receiveOrderTimeStart.substring(5,10)+'日'+receiveOrderTimeStart.substring(11,16)+'到'+receiveOrderTimeEnd.substring(11,16)+'上门收取！',time: 5,end: function(){location.href = "../../index2app.jsp?toPage=1&curPage=last";}});
				}else{
					layer.open({content: '提交失败，请重试！',time: 2});
				}
		 });
	 });
	 function getDateString(date){
		 //var date = new Date();
		 var str = "";
		 date.setDate(date.getDate()+2);
		 for(var i=3;i<=8;i++){
			 date.setDate(date.getDate()+1);
			 str += "<option value='"+i+"'>"+date.Format("yyyy-MM-dd")+"</option>";
		 }
		 return str;
	 }
	 function getTimeString(){
		 for(var i=8;i<=18;i+=2){
			 str += "<option value='"+i+"'>"+i+":00--"+(i+2)+":00"+"</option>";
		 }
		 return str;
	 }
	 function loadImages() {
	        if (document.getElementById) { // DOM3 = IE5, NS6
	            document.getElementById('hidepage').style.visibility = 'hidden';
	        } else {
	            if (document.layers) { // Netscape 4
	                document.hidepage.visibility = 'hidden';
	            } else { // IE 4
	                document.all.hidepage.style.visibility = 'hidden';
	            }
	        }
	        var openid=$.session.get("platformId");
	        if(typeof openid == "undefined"||openid==""){
	        	location.href = "../returnMsg.jsp?isapp=0"
				//layer.open({content: '请先注册！',time: 2,end: function(){location.href = "../returnMsg.jsp?isapp=0"}});
			}
	    }
	</script>
</body>
</html>